package com.gopay.bis.dao.tolly.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Repository;

import com.gopay.bis.dao.tolly.BisQueryValidatorDAO;
import com.gopay.common.base.dao.impl.BaseDAOImpl;
import com.gopay.common.domain.bank.outside.gboss.resp.query.validator.EduInfo;
import com.gopay.common.domain.bis.BisRealNameCertify;
/**
 * 学历认证数据库操作DAO
 * @BisQueryValidatorDAOImpl.java
 * @author lilili
 * @2016年6月14日 下午4:23:25  www.gopay.com.cn Inc.All rights reserved.
 */
@Repository(value = "bisQueryValidatorDAO")
public class BisQueryValidatorDAOImpl extends BaseDAOImpl<EduInfo, String> implements BisQueryValidatorDAO {

	/**
	 * 定义日志对象
	 */
	private static final Logger logger = LoggerFactory.getLogger(BisQueryValidatorDAOImpl.class);
	
	@Override
	public EduInfo getBisQueryValidator(String name, String identityCode) {
		/**
		 * 定义查询SQL
		 */
		StringBuffer hql = new StringBuffer("FROM EduInfo where name=:name and identityCode=:identityCode");
		/**
		 * 封装查询条件
		 */
		Map<String, Object> param = new HashMap<String, Object>();
		param.put("name", name);
		param.put("identityCode", identityCode);
		
		List<EduInfo> resultList=null;
		try{
			resultList = this.findByHql(hql.toString(), param);
		}catch(Exception e){
			logger.info("查询学历认证记录出现问题："+e.getMessage());
		}
		if (resultList == null || resultList.size() == 0) {
			return null;
		}
		return resultList.get(0);
	}

	@Override
	public void insertBisQueryValidator(EduInfo eduInfo) {
		this.getHibernateTemplate().save(eduInfo);
		
	}

	
}
